package frontend;

import java.awt.Color;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import org.dyno.visual.swing.layouts.Constraints;
import org.dyno.visual.swing.layouts.GroupLayout;
import org.dyno.visual.swing.layouts.Leading;

import backend.GodMode;
import concrete.Dice;


//VS4E -- DO NOT REMOVE THIS LINE!
public class GodModeDialog extends JDialog {

	private static final long serialVersionUID = 1L;
	
	private GodMode godMode;
	private Dice dice;
	private BoardFrame boardFrame;
	
	private JButton communityChestButton;
	private JButton chanceCardsButton;
	private JButton diceDoublesAlwaysButton;
	private JButton diceNormalButton;
	private JButton diceSetValueButton;
	private JButton stationTestButton;
	private JButton propertyUtilityButton;
	private JButton estateTestButton;
	private JButton goToJailButton;
	private JButton taxesTestButton;
	private JButton diceDoublesNeverButton;
	private JButton setCashButton;
	private JButton doneButton;
	private JLabel backgroundImage;
	private static final String PREFERRED_LOOK_AND_FEEL = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";

	public GodModeDialog() {
		initComponents();
	}

	public GodModeDialog(BoardFrame parent,GodMode testerMode) {
		super(parent,true);
		this.godMode = testerMode;
		this.dice = parent.getDice();
		this.boardFrame = parent;
		initComponents();
	}


	public BoardFrame getBoardFrame() {
		return this.boardFrame;
	}
	public GodMode getTesterMode() {
		return this.godMode;
	}


	public void setTesterMode(GodMode testerMode) {
		this.godMode = testerMode;
	}
	public void setBoardFrame(BoardFrame boardFrame) {
		this.boardFrame = boardFrame;
	}


	private void initComponents() {
		setTitle("God Mode");
		setLocation(128,148);
		setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
		setFont(new Font("Dialog", Font.PLAIN, 12));
		setBackground(Color.white);
		setResizable(false);
		setForeground(Color.black);
		setLayout(new GroupLayout());
		add(initDiceNormalButton(), new Constraints(new Leading(52, 78, 6, 6), new Leading(35, 10, 10)));
		add(initDiceDoublesNeverButton(), new Constraints(new Leading(222, 78, 10, 10), new Leading(35, 6, 6)));
		add(initDiceSetValueButton(), new Constraints(new Leading(307, 79, 6, 6), new Leading(35, 6, 6)));
		add(initDiceDoublesAlwaysButton(), new Constraints(new Leading(136, 6, 6), new Leading(35, 6, 6)));
		add(initPropertyUtilityButton(), new Constraints(new Leading(52, 78, 6, 6), new Leading(116, 10, 10)));
		add(initStationButton(), new Constraints(new Leading(137, 78, 6, 6), new Leading(116, 6, 6)));
		add(initEstateTestButton(), new Constraints(new Leading(222, 78, 6, 6), new Leading(116, 6, 6)));
		add(initChanceCardsButton(), new Constraints(new Leading(52, 78, 6, 6), new Leading(197, 10, 10)));
		add(initCommunityChestButton(), new Constraints(new Leading(137, 78, 6, 6), new Leading(197, 6, 6)));
		add(initGoToJailButton(), new Constraints(new Leading(137, 78, 6, 6), new Leading(278, 6, 6)));
		add(initTaxesTestButton(), new Constraints(new Leading(52, 78, 6, 6), new Leading(278, 6, 6)));
		add(initSetCashButton(), new Constraints(new Leading(306, 6, 6), new Leading(116, 6, 6)));
		add(initDoneButton(), new Constraints(new Leading(404, 6, 6), new Leading(35, 6, 6)));
		
		add(getBackgroundImage(), new Constraints(new Leading(0, 6, 6), new Leading(0, 6, 6)));
		addWindowListener(new WindowAdapter() {
	
			public void windowClosing(WindowEvent event) {
			}
		});
		setSize(505, 418);
	}


	private JLabel getBackgroundImage() {
		if (backgroundImage == null) {
			backgroundImage = new JLabel();
			backgroundImage.setIcon(new ImageIcon(getClass().getResource("/images/godMode/GodMode.jpg")));
		}
		return backgroundImage;
	}
	private JButton initDoneButton() {
		if (doneButton == null) {
			doneButton = new JButton();
			doneButton.setText("DONE");
			doneButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					closeActionActionPerformed(event);
				}
			});
		}
		return doneButton;
	}
	@SuppressWarnings("serial")
	private JButton initSetCashButton() {
		if (setCashButton == null) {
			setCashButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }
			};

			setCashButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/SetCash.png")));
			setCashButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/SetCash.png")));
			setCashButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/SetCash.png")));
			setCashButton.setToolTipText("Set Current Player Cash");
			setCashButton.setBorderPainted(false);
			setCashButton.setBorder(null);
			setCashButton.setContentAreaFilled(false);
			setCashButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					setCashActionActionPerformed(event);
				}
			});
		}
		return setCashButton;
	}
	@SuppressWarnings("serial")
	private JButton initDiceDoublesAlwaysButton() {
		if (diceDoublesAlwaysButton == null) {
			diceDoublesAlwaysButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }
			};
			if(0==this.godMode.getMode())
				diceDoublesAlwaysButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceAlwaysDoubles.png")));
			else {
				diceDoublesAlwaysButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceAlwaysDoubles.png")));
				diceDoublesAlwaysButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceAlwaysDoubles.png")));
				diceDoublesAlwaysButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceAlwaysDoubles.png")));
			}
			diceDoublesAlwaysButton.setToolTipText("Set Dice to Always Double");
			diceDoublesAlwaysButton.setBorderPainted(false);
			diceDoublesAlwaysButton.setBorder(null);
			diceDoublesAlwaysButton.setContentAreaFilled(false);
			diceDoublesAlwaysButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					doublesActionActionPerformed(event);
				}
			});
		}
		return diceDoublesAlwaysButton;
	}
	@SuppressWarnings("serial")
	private JButton initDiceDoublesNeverButton() {
		if (diceDoublesNeverButton == null) {
			diceDoublesNeverButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(1==this.godMode.getMode())
				diceDoublesNeverButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNeverDoubles.png")));
			else {
				diceDoublesNeverButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceNeverDoubles.png")));
				diceDoublesNeverButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceNeverDoubles.png")));
				diceDoublesNeverButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceNeverDoubles.png")));
			}
			diceDoublesNeverButton.setToolTipText("Set Dice to Never Double");
			diceDoublesNeverButton.setBorderPainted(false);
			diceDoublesNeverButton.setBorder(null);
			diceDoublesNeverButton.setContentAreaFilled(false);
			diceDoublesNeverButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					diceDoublesNeverActionActionPerformed(event);
				}
			});
		}
		return diceDoublesNeverButton;
	}
	@SuppressWarnings("serial")
	private JButton initDiceSetValueButton() {
		if (diceSetValueButton == null) {
			diceSetValueButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(2==this.godMode.getMode())
				diceSetValueButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceSetValue.png")));
			else {
				diceSetValueButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceSetValue.png")));
				diceSetValueButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceSetValue.png")));
				diceSetValueButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceSetValue.png")));
			}
			diceSetValueButton.setToolTipText("Set Dice Value");
			diceSetValueButton.setBorderPainted(false);
			diceSetValueButton.setBorder(null);
			diceSetValueButton.setContentAreaFilled(false);
			diceSetValueButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					setValueActionActionPerformed(event);
				}
			});
		}
		return diceSetValueButton;
	}

	public JButton getDiceSetValue2() {
		return this.diceSetValueButton;
	}
	
	@SuppressWarnings("serial")
	private JButton initDiceNormalButton() {
		if (diceNormalButton == null) {
			diceNormalButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(3==this.godMode.getMode())
				diceNormalButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNormal.png")));
			else {
				diceNormalButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceNormal.png")));
				diceNormalButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceNormal.png")));
				diceNormalButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceNormal.png")));
			}
			diceNormalButton.setToolTipText("Set Dice to Normal");
			diceNormalButton.setBorderPainted(false);
			diceNormalButton.setBorder(null);
			diceNormalButton.setContentAreaFilled(false);
			diceNormalButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					normalActionActionPerformed(event);
				}
			});
		}
		return diceNormalButton;
	}

	@SuppressWarnings("serial")
	private JButton initPropertyUtilityButton() {
		if (propertyUtilityButton == null) {
			propertyUtilityButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(4==this.godMode.getMode())
				propertyUtilityButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/UtilityProperties.png")));
			else {
				propertyUtilityButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/UtilityProperties.png")));
				propertyUtilityButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/UtilityProperties.png")));
				propertyUtilityButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/UtilityProperties.png")));
			}
			propertyUtilityButton.setToolTipText("Test Utility Properties");
			propertyUtilityButton.setBorderPainted(false);
			propertyUtilityButton.setBorder(null);
			propertyUtilityButton.setContentAreaFilled(false);
			propertyUtilityButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					utilityActionActionPerformed(event);
				}
			});
		}
		return propertyUtilityButton;
	}

	@SuppressWarnings("serial")
	private JButton initStationButton() {
		if (stationTestButton == null) {
			stationTestButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(5==this.godMode.getMode())
				stationTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/StationProperties.png")));
			else {
				stationTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/StationProperties.png")));
				stationTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/StationProperties.png")));
				stationTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/StationProperties.png")));
			}
			stationTestButton.setToolTipText("Test Station Properties");
			stationTestButton.setBorderPainted(false);
			stationTestButton.setBorder(null);
			stationTestButton.setContentAreaFilled(false);
			stationTestButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					stationTestActionActionPerformed(event);
				}
			});
		}
		return stationTestButton;
	}	

	@SuppressWarnings("serial")
	private JButton initEstateTestButton() {
		if (estateTestButton == null) {
			estateTestButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(6==this.godMode.getMode())
				estateTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/EstateProperties.png")));
			else {
				estateTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/EstateProperties.png")));
				estateTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/EstateProperties.png")));
				estateTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/EstateProperties.png")));
			}
			estateTestButton.setToolTipText("Test Estate Properties");
			estateTestButton.setBorderPainted(false);
			estateTestButton.setBorder(null);
			estateTestButton.setContentAreaFilled(false);
			estateTestButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					estateTestActionActionPerformed(event);
				}
			});
		}
		return estateTestButton;
	}

	@SuppressWarnings("serial")
	private JButton initChanceCardsButton() {
		if (chanceCardsButton == null) {
			chanceCardsButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(7==this.godMode.getMode())
				chanceCardsButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/ChanceCards.png")));
			else {
				chanceCardsButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/ChanceCards.png")));
				chanceCardsButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/ChanceCards.png")));
				chanceCardsButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/ChanceCards.png")));
			}
			chanceCardsButton.setToolTipText("Test Chance Card Tiles");
			chanceCardsButton.setBorderPainted(false);
			chanceCardsButton.setBorder(null);
			chanceCardsButton.setContentAreaFilled(false);
			chanceCardsButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					chanceActionActionPerformed(event);
				}
			});
		}
		return chanceCardsButton;
	}

	@SuppressWarnings("serial")
	private JButton initCommunityChestButton() {
		if (communityChestButton == null) {
			communityChestButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(8==this.godMode.getMode())
				communityChestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/CommunityChest.png")));
			else {
				communityChestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/CommunityChest.png")));
				communityChestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/CommunityChest.png")));
				communityChestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/CommunityChest.png")));
			}
			communityChestButton.setToolTipText("Test Community Chest Tiles");
			communityChestButton.setBorderPainted(false);
			communityChestButton.setBorder(null);
			communityChestButton.setContentAreaFilled(false);
			communityChestButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					communityActionActionPerformed(event);
				}
			});
		}
		return communityChestButton;
	}

	@SuppressWarnings("serial")
	private JButton initTaxesTestButton() {
		if (taxesTestButton == null) {
			taxesTestButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(9==this.godMode.getMode())
				taxesTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/Tax.png")));
			else {
				taxesTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/Tax.png")));
				taxesTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/Tax.png")));
				taxesTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/Tax.png")));
			}
			taxesTestButton.setToolTipText("Set Tax Tiles");
			
			taxesTestButton.setBorderPainted(false);
			taxesTestButton.setBorder(null);
			taxesTestButton.setContentAreaFilled(false);
			taxesTestButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					taxesTestActionActionPerformed(event);
				}
			});
		}
		return taxesTestButton;
	}

	@SuppressWarnings("serial")
	private JButton initGoToJailButton() {
		if (goToJailButton == null) {
			goToJailButton = new JButton() {
				public Point getToolTipLocation(MouseEvent event) {
			        return new Point(0, 4*getHeight()/5);
			    }

			};
			if(10==this.godMode.getMode())
				goToJailButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/GoToJail.png")));
			else {
				goToJailButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/GoToJail.png")));
				goToJailButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/GoToJail.png")));
				goToJailButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/GoToJail.png")));
			}
			goToJailButton.setToolTipText("Test Go to Jail Tile");
			goToJailButton.setBorderPainted(false);
			goToJailButton.setBorder(null);
			goToJailButton.setContentAreaFilled(false);
			goToJailButton.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					goToJailActionActionPerformed(event);
				}
			});
		}
		return goToJailButton;
	}

	private static void installLnF() {
		try {
			String lnfClassname = PREFERRED_LOOK_AND_FEEL;
			if (lnfClassname == null)
				lnfClassname = UIManager.getCrossPlatformLookAndFeelClassName();
			UIManager.setLookAndFeel(lnfClassname);
		} catch (Exception e) {
			System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL
					+ " on this platform:" + e.getMessage());
		}
	}

	public void resetButtons() {

		diceDoublesAlwaysButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceAlwaysDoubles.png")));
		diceDoublesAlwaysButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceAlwaysDoubles.png")));
		diceDoublesAlwaysButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceAlwaysDoubles.png")));

		diceDoublesNeverButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceNeverDoubles.png")));
		diceDoublesNeverButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceNeverDoubles.png")));
		diceDoublesNeverButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceNeverDoubles.png")));

		diceSetValueButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceSetValue.png")));
		diceSetValueButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceSetValue.png")));
		diceSetValueButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceSetValue.png")));

		diceNormalButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/DiceNormal.png")));
		diceNormalButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/DiceNormal.png")));
		diceNormalButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/DiceNormal.png")));

		propertyUtilityButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/UtilityProperties.png")));
		propertyUtilityButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/UtilityProperties.png")));
		propertyUtilityButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/UtilityProperties.png")));

		stationTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/StationProperties.png")));
		stationTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/StationProperties.png")));
		stationTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/StationProperties.png")));

		estateTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/EstateProperties.png")));
		estateTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/EstateProperties.png")));
		estateTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/EstateProperties.png")));

		chanceCardsButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/ChanceCards.png")));
		chanceCardsButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/ChanceCards.png")));
		chanceCardsButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/ChanceCards.png")));

		communityChestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/CommunityChest.png")));
		communityChestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/CommunityChest.png")));
		communityChestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/CommunityChest.png")));

		taxesTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/Tax.png")));
		taxesTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/Tax.png")));
		taxesTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/Tax.png")));

		goToJailButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonNormal/GoToJail.png")));
		goToJailButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseHover/GoToJail.png")));
		goToJailButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonMouseClick/GoToJail.png")));
	}
	public void resetDiceMode() {
		this.dice.setDoublesMode(false);
		this.dice.setNeverDoubles(false);
	}

	/**
	 * Main entry of the class.
	 * Note: This class is only created so that you can easily preview the result at runtime.
	 * It is not expected to be managed by the designer.
	 * You can modify it as you like.
	 */
	public static void main(String[] args) {
		installLnF();
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				GodModeDialog dialog = new GodModeDialog();
				dialog.setDefaultCloseOperation(GodModeDialog.DISPOSE_ON_CLOSE);
				dialog.setTitle("TesterModeDialog");
				dialog.setLocationRelativeTo(null);
				dialog.getContentPane().setPreferredSize(dialog.getSize());
				dialog.pack();
				dialog.setVisible(true);
			}
		});
	}

	private void doublesActionActionPerformed(ActionEvent event) {
		if(0!=this.godMode.getMode()) {
			this.resetButtons();
			diceDoublesAlwaysButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceAlwaysDoubles.png")));
			diceDoublesAlwaysButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceAlwaysDoubles.png")));
			diceDoublesAlwaysButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceAlwaysDoubles.png")));
			this.godMode.resetMode();
			if(!this.dice.getDoublesMode()) {
				this.resetDiceMode();
				this.dice.setDoublesMode(true);
			}
		}
	}

	private void diceDoublesNeverActionActionPerformed(ActionEvent event) {
		if(1!=this.godMode.getMode()) {
			this.resetButtons();
			diceDoublesNeverButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNeverDoubles.png")));
			diceDoublesNeverButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNeverDoubles.png")));
			diceDoublesNeverButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNeverDoubles.png")));
			this.godMode.setMode(1);
			if(!this.dice.getNeverDoubles()) {
				this.resetDiceMode();
				this.dice.setNeverDoubles(true);
			}
		}
	}

	private void setValueActionActionPerformed(ActionEvent event) {
		
		SetDiceValueDialog input = new SetDiceValueDialog(this,this.godMode);
		input.setVisible(true);
		
	}

	private void normalActionActionPerformed(ActionEvent event) {
		if(3!=this.godMode.getMode()) {
			this.resetButtons();
			diceNormalButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNormal.png")));
			diceNormalButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNormal.png")));
			diceNormalButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/DiceNormal.png")));
			this.resetDiceMode();
			this.godMode.setMode(3);
		}
		if(this.dice.getDoublesMode()) {
			this.dice.setDoublesMode(false);
		}
	}

	private void utilityActionActionPerformed(ActionEvent event) {
		if(4!=this.godMode.getMode()) {
			this.resetButtons();
			propertyUtilityButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/UtilityProperties.png")));
			propertyUtilityButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/UtilityProperties.png")));
			propertyUtilityButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/UtilityProperties.png")));
			this.resetDiceMode();
			this.godMode.setMode(4);
		}
	}

	private void stationTestActionActionPerformed(ActionEvent event) {
		if(5!=this.godMode.getMode()) {
			this.resetButtons();
			stationTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/StationProperties.png")));
			stationTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/StationProperties.png")));
			stationTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/StationProperties.png")));
			this.resetDiceMode();
			this.godMode.setMode(5);
		}
	}

	private void estateTestActionActionPerformed(ActionEvent event) {
		if(6!=this.godMode.getMode()) {
			this.resetButtons();
			estateTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/EstateProperties.png")));
			estateTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/EstateProperties.png")));
			estateTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/EstateProperties.png")));
			this.resetDiceMode();
			this.godMode.setMode(6);
		}
	}

	private void chanceActionActionPerformed(ActionEvent event) {
		if(7!=this.godMode.getMode()) {
			this.resetButtons();
			chanceCardsButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/ChanceCards.png")));
			chanceCardsButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/ChanceCards.png")));
			chanceCardsButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/ChanceCards.png")));
			this.resetDiceMode();
			this.godMode.setMode(7);
		}
	}

	private void communityActionActionPerformed(ActionEvent event) {
		if(8!=this.godMode.getMode()) {
			this.resetButtons();
			communityChestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/CommunityChest.png")));
			communityChestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/CommunityChest.png")));
			communityChestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/CommunityChest.png")));
			this.resetDiceMode();
			this.godMode.setMode(8);
		}
		
	}

	private void taxesTestActionActionPerformed(ActionEvent event) {
		if(9!=this.godMode.getMode()) {
			this.resetButtons();
			taxesTestButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/Tax.png")));
			taxesTestButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/Tax.png")));
			taxesTestButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/Tax.png")));
			this.resetDiceMode();
			this.godMode.setMode(9);
		}
	}

	private void goToJailActionActionPerformed(ActionEvent event) {
		if(10!=this.godMode.getMode()) {
			this.resetButtons();
			goToJailButton.setIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/GoToJail.png")));
			goToJailButton.setRolloverIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/GoToJail.png")));
			goToJailButton.setPressedIcon(new ImageIcon(getClass().getResource("/images/godMode/buttonSelected/GoToJail.png")));
			this.resetDiceMode();
			this.godMode.setMode(10);
		}
	}

	private void closeActionActionPerformed(ActionEvent event) {
		this.dispose();
	}

	private void setCashActionActionPerformed(ActionEvent event) {
		
		SetCashDialog setCashDialog = new SetCashDialog(this, this.godMode, this.boardFrame);
		setCashDialog.setVisible(true);
	}

	

}
